package com.mycompany.app.hr.pa.model;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.apache.commons.lang.builder.ToStringBuilder;

@Entity
@Table(name = "employee_group")
public class EmployeeGroup {

    @Id
    @Column(name = "employee_group_id")
    private Integer id;

    @Column(name = "group_name")
    private String groupName;

    @OneToMany(cascade=CascadeType.ALL, mappedBy = "group", fetch = FetchType.EAGER)
    private Set<EmployeeSubgroup> subgroups;

    // ========================================================

    @Override
    public String toString() {

        return ToStringBuilder.reflectionToString(this);
    }

    // ========================================================

    public Integer getId() {

        return id;
    }

    public void setId(Integer id) {

        this.id = id;
    }

    public String getGroupName() {

        return groupName;
    }

    public void setGroupName(String groupName) {

        this.groupName = groupName;
    }

    public Set<EmployeeSubgroup> getSubgroups() {

        return subgroups;
    }

    public void setSubgroups(Set<EmployeeSubgroup> subgroups) {

        this.subgroups = subgroups;
    }

}
